<?php
if ($_GET['do']=='edit') {
	include_once 'icn/config.php';
	include_once 'icn/mysql.class.php';
	$id = $_GET['id'];
	$mysql= new  mysql();
	$mysql->open($dbconfig);
	$order = $mysql->get_one('*', 'order',"`id`=$id");
	
}elseif ($_GET['do']=='editpost'){
	include_once 'icn/config.php';
	include_once 'icn/mysql.class.php';
	$mysql= new mysql();
	$mysql->open($dbconfig);
	$orderupdata = array(
		'huohao'=>$_POST[huohao],
		'kuanhao'=>$_POST[kuanhao],
		'pinming'=>$_POST[pinming],
		'zhuangxiangshu'=>$_POST[zhuangxiangshu],
		'newdate'=>$_POST[newdate]
	);
	if ($mysql->update($orderupdata, 'order',"`id`=$_POST[id]")) {
		echo "<script language='JavaScript'>alert('修改成功！');location='main.php';</script>";
	}else {
		echo "<script language='JavaScript'>alert('修改失败！');location='order.php?do=editpost&id=$_POST[id]'</script>";
	}
}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<form action="order.php?do=editpost" method="post">
<table width="291" border="0" align="center">
  <tr>
    <th width="80" scope="row">ID</th>
    <td width="201"><input type="hidden" name="id" id="id" value="<?php echo $order[id]?>"/><?php echo $order[id]?></td>
  </tr>
  <tr>
    <th scope="row">货号</th>
    <td><label>
      <input name="huohao" type="text" id="huohao" value="<?php echo $order[huohao]?>" />
    </label></td>
  </tr>
  <tr>
    <th scope="row">款号</th>
    <td><label>
      <input name="kuanhao" type="text" id="kuanhao" value="<?php echo $order[kuanhao]?>" />
    </label></td>
  </tr>
  <tr>
    <th scope="row">品名</th>
    <td><label>
      <input name="pinming" type="text" id="pinming" value="<?php echo $order[pinming]?>" />
    </label></td>
  </tr>
  <tr>
    <th scope="row">装箱数</th>
    <td><label>
      <input name="zhuangxiangshu" type="text" id="zhuangxiangshu" value="<?php echo $order[zhuangxiangshu]?>" />
    </label></td>
  </tr>
  <tr>
    <th scope="row">时间</th>
    <td><label>
      <input name="newdate" type="text" id="newdate" value="<?php echo $order[newdate]?>" />
    </label></td>
  </tr>
  <tr>
    <th colspan="2" scope="row"><label>
      <input type="submit" name="submit" id="submit" value="提交" />
    </label></th>
  </tr>
</table>
</form>

</body>
</html>